import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
  { path: '/login', component: () => import('@/views/Login/index.vue') },
  {
    path: '/',
    component: () => import('@/views/Layout/index.vue'),
    children: [
      { path: '', component: () => import('@/views/Home/index.vue') },
      { path: 'category/:id', component: () => import('@/views/category/index.vue') },
      { path: 'goods/:id', component: () => import('@/views/Good/index.vue') },
      { path: 'cart', component: () => import('@/views/cart/index.vue') },
      { path: 'settlement', component: () => import('@/views/settlement/index.vue') }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(), // 使用hash的方式实现路由
  routes // 路由规则数组
})

export default router
